*************************************************
*****Replication file for Pelchar and Herron*****
****************PS SPOTLIGHT*********************
*************************************************

***if necessary, change [LOCATION] to the path of replication files on your computer
***default is to use current working directory
***use [LOCATION]/ps_replication.smcl
log using "ps_replication.smcl", replace

***use [LOCATION]/ps_replication.dta
use "ps_replication.dta"

*************************************************
*****************TABLE 1*************************
*************************************************

*****************APRIL 2021**********************

svyset [pweight=weight_421]

***Create variables that combine trust/somewhat trust

***Parliament***
gen t_par=t_par_421
replace t_par=. if t_par_421>5
replace t_par=0 if t_par_421==1|t_par_421==2|t_par_421==3
replace t_par=1 if t_par_421==4|t_par_421==5
svy: tab t_par

***President***
gen t_pres=t_pres_421
replace t_pres=. if t_pres_421>5
replace t_pres=0 if t_pres_421==1|t_pres_421==2|t_pres_421==3
replace t_pres=1 if t_pres_421==4|t_pres_421==5
svy: tab t_pres

***Military***
gen t_mil=t_mil_421
replace t_mil=. if t_mil_421>5
replace t_mil=0 if t_mil_421==1|t_mil_421==2|t_mil_421==3
replace t_mil=1 if t_mil_421==4|t_mil_421==5
svy: tab t_mil

clear

*****************SEPTEMBER 2021**********************

***use [LOCATION]/ps_replication.dta

use "ps_replication.dta"



svyset [pweight=weight_921]

***Create variables that combine trust/somewhat trust

***Parliament***
gen t_par=t_par_921
replace t_par=. if t_par_921>5
replace t_par=0 if t_par_921==1|t_par_921==2|t_par_921==3
replace t_par=1 if t_par_921==4|t_par_921==5
svy: tab t_par

***President***
gen t_pres=t_pres_921
replace t_pres=. if t_pres_921>5
replace t_pres=0 if t_pres_921==1|t_pres_921==2|t_pres_921==3
replace t_pres=1 if t_pres_921==4|t_pres_921==5
svy: tab t_pres

***Military***
gen t_mil=t_mil_921
replace t_mil=. if t_mil_921>5
replace t_mil=0 if t_mil_921==1|t_mil_921==2|t_mil_921==3
replace t_mil=1 if t_mil_921==4|t_mil_921==5
svy: tab t_mil

clear

*****************FEBRUARY 2022**********************

***use [LOCATION]/ps_replication.dta

use "ps_replication.dta"

svyset [pweight=weight_222]

***Create variables that combine trust/somewhat trust

***Parliament***
gen t_par=t_par_222
replace t_par=. if t_par_222>5
replace t_par=0 if t_par_222==1|t_par_222==2|t_par_222==3
replace t_par=1 if t_par_222==4|t_par_222==5
svy: tab t_par

***President***
gen t_pres=t_pres_222
replace t_pres=. if t_pres_222>5
replace t_pres=0 if t_pres_222==1|t_pres_222==2|t_pres_222==3
replace t_pres=1 if t_pres_222==4|t_pres_222==5
svy: tab t_pres

***Military***
gen t_mil=t_mil_222
replace t_mil=. if t_mil_222>5
replace t_mil=0 if t_mil_222==1|t_mil_222==2|t_mil_222==3
replace t_mil=1 if t_mil_222==4|t_mil_222==5
svy: tab t_mil

clear

*****************MAY 2022**********************

***use [LOCATION]/ps_replication.dta

use "ps_replication.dta"

svyset [pweight=weight_522]

***Create variables that combine trust/somewhat trust

***Parliament***
gen t_par=t_par_522
replace t_par=. if t_par_522>5
replace t_par=0 if t_par_522==1|t_par_522==2|t_par_522==3
replace t_par=1 if t_par_522==4|t_par_522==5
svy: tab t_par

***President***
gen t_pres=t_pres_522
replace t_pres=. if t_pres_522>5
replace t_pres=0 if t_pres_522==1|t_pres_522==2|t_pres_522==3
replace t_pres=1 if t_pres_522==4|t_pres_522==5
svy: tab t_pres

***Military***
gen t_mil=t_mil_522
replace t_mil=. if t_mil_522>5
replace t_mil=0 if t_mil_522==1|t_mil_522==2|t_mil_522==3
replace t_mil=1 if t_mil_522==4|t_mil_522==5
svy: tab t_mil

clear

*****************NOVEMBER 2022**********************

***use [LOCATION]/ps_replication.dta

use "ps_replication.dta"

svyset [pweight=weight_1122]

***Create variables that combine trust/somewhat trust

***Parliament***
gen t_par=t_par_1122
replace t_par=. if t_par_1122>5
replace t_par=0 if t_par_1122==1|t_par_1122==2|t_par_1122==3
replace t_par=1 if t_par_1122==4|t_par_1122==5
svy: tab t_par

***President***
gen t_pres=t_pres_1122
replace t_pres=. if t_pres_1122>5
replace t_pres=0 if t_pres_1122==1|t_pres_1122==2|t_pres_1122==3
replace t_pres=1 if t_pres_1122==4|t_pres_1122==5
svy: tab t_pres

***Military***
gen t_mil=t_mil_1122
replace t_mil=. if t_mil_1122>5
replace t_mil=0 if t_mil_1122==1|t_mil_1122==2|t_mil_1122==3
replace t_mil=1 if t_mil_1122==4|t_mil_1122==5
svy: tab t_mil

clear

*****************SEPTEMBER 2023**********************

***use [LOCATION]/ps_replication.dta

use "ps_replication.dta"

svyset [pweight=weight_923]

***Create variables that combine trust/somewhat trust

***Parliament***
gen t_par=t_par_923
replace t_par=. if t_par_923>5
replace t_par=0 if t_par_923==1|t_par_923==2|t_par_923==3
replace t_par=1 if t_par_923==4|t_par_923==5
svy: tab t_par

***President***
gen t_pres=t_pres_923
replace t_pres=. if t_pres_923>5
replace t_pres=0 if t_pres_923==1|t_pres_923==2|t_pres_923==3
replace t_pres=1 if t_pres_923==4|t_pres_923==5
svy: tab t_pres

***Military***
gen t_mil=t_mil_923
replace t_mil=. if t_mil_923>5
replace t_mil=0 if t_mil_923==1|t_mil_923==2|t_mil_923==3
replace t_mil=1 if t_mil_923==4|t_mil_923==5
svy: tab t_mil

clear

*****************JUNE 2024**********************

***use [LOCATION]/ps_replication.dta

use "ps_replication.dta"

svyset [pweight=weight_624]

***Create variables that combine trust/somewhat trust

***Parliament***
gen t_par=_v4
replace t_par=. if _v4>5
replace t_par=0 if _v4==1|_v4==2|_v4==3
replace t_par=1 if _v4==4|_v4==5
svy: tab t_par

***President***
gen t_pres=_v3
replace t_pres=. if _v3>5
replace t_pres=0 if _v3==1|_v3==2|_v3==3
replace t_pres=1 if _v3==4|_v3==5
svy: tab t_pres

***Military***
gen t_mil=t_mil_923
replace t_mil=. if _v9>5
replace t_mil=0 if _v9==1| _v9==2| _v9==3
replace t_mil=1 if _v9==4| _v9==5
svy: tab t_mil

******************************************************************************
**************************************TABLE 2*********************************
******************************************************************************

****Relationship Variables*****

***President-Parliament***

gen pres_par=_v25
replace pres_par=1 if _v25==1|_v25==2
replace pres_par=2 if _v25==3
replace pres_par=3 if _v25==4|_v25==5
replace pres_par=. if _v25>5
svy: tab pres_par

***President-AFU***

gen pres_afu=_v27
replace pres_afu=1 if _v27==1|_v27==2
replace pres_afu=2 if _v27==3
replace pres_afu=3 if _v27==4|_v27==5
replace pres_afu=. if _v27>5
svy: tab pres_afu

***Parliament-AFU***

gen par_afu=_v29
replace par_afu=1 if _v29==1|_v29==2
replace par_afu=2 if _v29==3
replace par_afu=3 if _v29==4|_v29==5
replace par_afu=. if _v29>5
svy: tab par_afu

clear

log close
